package com.managertrade.dao.mysql.repository;


import com.managertrade.dao.mysql.entity.SysUserRole;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface SysUserRoleRepository extends JpaRepository<SysUserRole, Long> {
    List<SysUserRole> findByUserId(Long userId);
    List<SysUserRole> findByroleId(Long userId);
    List<SysUserRole> findByUserIdIn(List<Long> userIds);

    @Modifying
    @Query("DELETE FROM SysUserRole r WHERE r.id IN :ids")
    void deleteByIds(@Param("ids") List<Long> ids);
}